package com.delay.queue.controller;

import com.delay.queue.delayedqueue.rabbitmq.MessageProduce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author gxing
 * @desc MQ
 * @date 2021/3/22
 */
@RestController
@RequestMapping("/rabbitmq")
public class RabbitMQMsgController {

    @Autowired
    private MessageProduce messageProduce;

    @RequestMapping("/send")
    public void sendDelayMsg(String msg) throws IOException {
        messageProduce.sendDelayMessage(msg + ":" + System.currentTimeMillis() / 1000);
    }

    @RequestMapping("/xdelay")
    public void xdelay(String msg) throws IOException {
        messageProduce.xDelayedMessage(msg + ":" + System.currentTimeMillis() / 1000);
    }

}
